import 'package:flutter/material.dart';
import 'package:english_words/english_words.dart';
import 'package:flutter_swiper/flutter_swiper.dart';

class HomePage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return Page();
  }
}
class Page extends State<HomePage>{
  final _itemList = <WordPair>[];
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return layout(context);
  }
  Widget layout(BuildContext context){
    return Scaffold(
//      appBar: buildAppBar(context),
      body:
      /*ListView.builder(
        padding: EdgeInsets.all(10.0),
        itemBuilder: (context,i){
          print(i);
          if(i.isOdd) return Divider();
          final index = i~/2;
          if(index>=_itemList.length){
            _itemList.addAll(generateWordPairs().take(10));
          }
          return _buildRow(_itemList[index]);
        },
      ),*/
      /*ListView(
        children: <Widget>[
          getImageFromNet('http://i2.yeyou.itc.cn/2014/huoying/hd_20140925/hyimage06.jpg'),
          getImageFromNet('http://i2.yeyou.itc.cn/2014/huoying/hd_20140925/hyimage06.jpg'),
          getImageFromNet('http://i2.yeyou.itc.cn/2014/huoying/hd_20140925/hyimage06.jpg'),
          getImageFromNet('http://i2.yeyou.itc.cn/2014/huoying/hd_20140925/hyimage06.jpg'),
          getImageFromNet('http://i2.yeyou.itc.cn/2014/huoying/hd_20140925/hyimage06.jpg'),
        ],
      ),*/
      /*Swiper(
        itemBuilder: (BuildContext context,int index){
          return new Image.network('http://i2.yeyou.itc.cn/2014/huoying/hd_20140925/hyimage06.jpg',fit: BoxFit.fill,);
        },
        itemCount: 3,
        pagination: new SwiperPagination(),
        control: new SwiperControl(),
      ),*/
      CustomScrollView(
        controller: null,
        slivers: <Widget>[
          SliverPadding(padding: EdgeInsets.all(5.0),sliver:SliverToBoxAdapter(child:Container(
            height: 250,
            child: ListView.builder(scrollDirection: Axis.horizontal,itemCount: 10,itemBuilder: (BuildContext context,int index){
              return getImageFromNet("http://img.rongyuejiaoyu.com/uploads/20190930/1b63b52ed7392d869a19a5a7bf01ce7b.jpg");
            },),) ,) ,),
        ],
      ),
    );
  }
  Widget buildAppBar(BuildContext context){
    return AppBar(title: Text('首页'),);
  }
  Widget _buildRow(WordPair wordPair){
    return ListTile(
      title: Text(wordPair.asCamelCase),
    );
  }
  Widget getImageFromNet(url){
    return Image.network(url);
  }
}